TitleWindow = function(){
	//定义一个load方法给让表单加载数据信息
	var loadInfo = function(rec){
		form.getForm().loadRecord(rec);
		
	}
	//获取表单信息并定义事件
	var submit = function(){
		if(form.getForm().isValid()){
			var data = form.getForm().getValues();
		    var win = form.ownerCt;
		    win.fireEvent('submit',win,form,data);
		}else{
			Ext.MessageBox.alert('系统提示','请填写合适的数据!');
		}
		
	}
	
	//建立form表单
	var form = new Ext.form.FormPanel(
		{
			frame:true,
			enableKeyEvents: true,
			defaults:{
				anchor:'90%',
				maxLength:50,
				maxLengthText:'最多不能超过50个字',
				listeners : {  
	                specialkey : function(field, e) {  
	                    if (e.getKey() == Ext.EventObject.ENTER) {  
	                        submit();
	                    }  
	                }  
	            }  
			},
			autoHeight: true,
			items:[
				{
					xtype:'textfield',
					name:'title',
					allowBlank:false,
					tabIndex:1,
					blankText:'栏目标题为必填项',
					fieldLabel:'栏目标题'
				},
				{
					xtype:'textfield',
					name:'tnote',
					tabIndex:2,
					blankText:'标题备注为必填项',
					fieldLabel:'标题备注'
				},{
					xtype:'hidden',
					name:'aid'
				},{
					xtype:'hidden',
					name:'tuserid',
					value:userinfo.uid
				}]
		}
	);
	
	//这里是Window的配置项
	var config = {
//		load:loadInfo,
		buttons:[
			{
				text:'确定',
				iconCls:'confirm',
				handler:submit,
				scope:this
			},
			{
				text:'取消',
				iconCls:'cancel',
				handler:function(){this.close()},
				scope:this
			}],
		items:[form],
		layout:'fit',
		constrain : true, 
		constrainHeader : true, 
		modal:true,
		title:'新增栏目标题',
		width:400,
		autoHeight:true 
	};
	TitleWindow.superclass.constructor.call(this,config);
}
Ext.extend(TitleWindow,Ext.Window);